﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using InstantNaukriDAL;
using System.IO;
using System.Globalization;
using System.ComponentModel;
using System.Windows.Forms;


public partial class JobseekerProfile : System.Web.UI.Page
{
    int ProfileId = 0, UserId = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["UserId"] == null)
                Response.Redirect("Default.aspx");
            string roleid = "";
            clsUserLoginDAL objclsUserLoginDAL = new clsUserLoginDAL();
            if (Request.QueryString["roleid"] != null)
                roleid = clsEncryptionDecryption.Decrypt(Request.QueryString["roleid"].ToString());
            if (roleid == "4")
            {
                IN_TB_USER objIN_TB_USER = new IN_TB_USER();
                if (Session["UserId"] != null)
                    objIN_TB_USER = objclsUserLoginDAL.GetUserByID(Convert.ToInt32(Session["UserId"].ToString()));
                if (objIN_TB_USER != null)
                {
                    Session["UserId"] = objIN_TB_USER.ID;
                    dvAutority.Visible = true;
                    Fillddls();
                    CreateRESUME_SKILLList();
                    CreateProjectList();
                    FillGeneralInfo(objIN_TB_USER.ID);
                    FillResumeDetails(objIN_TB_USER.ID);
                    FillProjectDetails(objIN_TB_USER.ID);
                    FillSkillsUsed(objIN_TB_USER.ID);
                    FillOtherInfo(objIN_TB_USER.ID);

                }
            }
        }
    }

    protected void FillGeneralInfo(int UserId)
    {
        try
        {
            clsProfileDAL objclsProfileDAL = new clsProfileDAL();
            IN_TB_PROFILE objIN_TB_PROFILE = new IN_TB_PROFILE();
            objIN_TB_PROFILE = objclsProfileDAL.GetProfileByUserId(UserId);
            if (objIN_TB_PROFILE != null)
            {
                ViewState["ProfileId"] = objIN_TB_PROFILE.ID;
                txtFirstName.Text = objIN_TB_PROFILE.F_NAME;
                txtMiddleName.Text = objIN_TB_PROFILE.M_NAME;
                txtLastName.Text = objIN_TB_PROFILE.L_NAME;
                DateTime dtdob = (DateTime)objIN_TB_PROFILE.DOB;
                txtDOB.Text = dtdob.ToString("dd-MMM-yyyy");
                ddlGender.SelectedValue = objIN_TB_PROFILE.GENDER;
                ddlCity.SelectedValue = Convert.ToString(objIN_TB_PROFILE.CITY);
                txtPhoneNumber.Text = objIN_TB_PROFILE.PHONE;
                txtMobileNumber.Text = objIN_TB_PROFILE.MOBILE;
                txtEmail.Text = objIN_TB_PROFILE.EMAIL;
                txtFather.Text = objIN_TB_PROFILE.FATHER;
            }
        }
        catch (Exception)
        {

            throw;
        }
    }

    protected void FillResumeDetails(int UserId)
    {
        try
        {
            clsResumeDAL objclsResumeDAL = new clsResumeDAL();
            IN_TB_RESUME_MST ibjIN_TB_RESUME_MST = new IN_TB_RESUME_MST();
            ibjIN_TB_RESUME_MST = objclsResumeDAL.GetResumeByUserId(UserId);
            if (ibjIN_TB_RESUME_MST != null)
            {
                ViewState["ResumeMasterId"] = ibjIN_TB_RESUME_MST.ID;
                txtKeySkills.Text = Convert.ToString(ibjIN_TB_RESUME_MST.KEY_SKILLS);
                txtResumeheadline.Text = Convert.ToString(ibjIN_TB_RESUME_MST.RESUME_HEADLINE);
                txtResumeSummary.Text = Convert.ToString(ibjIN_TB_RESUME_MST.RESUME_SUMMARY);
                txtCTC.Text = Convert.ToString(ibjIN_TB_RESUME_MST.CTC);
                txtCurrentCompany.Text = Convert.ToString(ibjIN_TB_RESUME_MST.CURRENT_COMPANY);
                txtCurrentDesignation.Text = Convert.ToString(ibjIN_TB_RESUME_MST.CURRENT_DESIGNATION);
                ddlPreferedLocation.SelectedValue = Convert.ToString(ibjIN_TB_RESUME_MST.PREFERRED_LOCATION);
                ddlcurrentLocation.SelectedValue = Convert.ToString(ibjIN_TB_RESUME_MST.CURRENT_LOCATION);
                ddlTotalExp.SelectedValue = Convert.ToString(ibjIN_TB_RESUME_MST.TOTAL_EXP);
                ddlFuntionalArea.SelectedValue = Convert.ToString(ibjIN_TB_RESUME_MST.FUNCTIONAL_AREA);
            }
        }
        catch (Exception)
        {

            throw;
        }
    }

    protected void FillProjectDetails(int UserId)
    {
        try
        {
            List<IN_TB_USER_PROJECT> objIN_TB_USER_PROJECTList = new List<IN_TB_USER_PROJECT>();
            clsProjectDetailDAL objclsProjectDetailDAL = new clsProjectDetailDAL();
            objIN_TB_USER_PROJECTList = objclsProjectDetailDAL.GetProjectByUserId(UserId);
            if (objIN_TB_USER_PROJECTList != null)
            {
                grdProjectDetails.DataSource = objIN_TB_USER_PROJECTList;
                grdProjectDetails.DataBind();
                Session["objIN_TB_USER_PROJECT"] = objIN_TB_USER_PROJECTList;
            }
        }
        catch (Exception)
        {

            throw;
        }
    }

    protected void FillSkillsUsed(int UserId)
    {
        try
        {
            List<IN_TB_RRESUME_SKILL> objIN_TB_RRESUME_SKILLList = new List<IN_TB_RRESUME_SKILL>();
            clsResumeSkillsDAL objclsResumeSkillsDAL = new clsResumeSkillsDAL();
            objIN_TB_RRESUME_SKILLList = objclsResumeSkillsDAL.GetResumeSkillsByUserId(UserId);
            if (objIN_TB_RRESUME_SKILLList != null)
            {
                grdTechnology.DataSource = objIN_TB_RRESUME_SKILLList;
                grdTechnology.DataBind();
                Session["objIN_TB_RRESUME_SKILLList"] = objIN_TB_RRESUME_SKILLList;
            }
        }
        catch (Exception)
        {

            throw;
        }
    }

    protected void FillOtherInfo(int UserId)
    {
        try
        {
            clsOtherDAL objclsOtherDAL = new clsOtherDAL();
            IN_TB_OTHER ibjIN_TB_OTHER = new IN_TB_OTHER();
            ibjIN_TB_OTHER = objclsOtherDAL.GetOtherinfoByUserId(UserId);
            if (ibjIN_TB_OTHER != null)
            {
                ddlDJobType.SelectedValue = Convert.ToString(ibjIN_TB_OTHER.DESIRED_JOB_TYPE);
                ddlDemploymentType.SelectedValue = Convert.ToString(ibjIN_TB_OTHER.DESIRED_EMPOLOYMENT_TYPE);
                ddlWorkPermitType.SelectedValue = Convert.ToString(ibjIN_TB_OTHER.WORK_PERMIT_LOCATION);
                ddlHaveVisa.SelectedValue = Convert.ToString(ibjIN_TB_OTHER.HAVE_VISA);
                ddlVisaType.SelectedValue = Convert.ToString(ibjIN_TB_OTHER.VISA_TYPE);
            }
        }
        catch (Exception)
        {

            throw;
        }
    }

    private void Fillddls()
    {
        try
        {
            // City
            clsCity objclsCity = new clsCity();
            List<IN_TB_CITY> objIN_TB_CITY = new List<IN_TB_CITY>();
            objIN_TB_CITY = objclsCity.GetAllCities();
            ddlCity.Items.Clear();
            ddlCity.AppendDataBoundItems = true;
            ddlCity.DataTextField = "CITY";
            ddlCity.DataValueField = "ID";
            ddlCity.Items.Add("Select");
            ddlCity.Items[0].Value = "0";
            ddlCity.DataSource = objIN_TB_CITY;
            ddlCity.DataBind();

            // Preferred Location
            objclsCity = new clsCity();
            objIN_TB_CITY = new List<IN_TB_CITY>();
            objIN_TB_CITY = objclsCity.GetAllCities();
            ddlPreferedLocation.Items.Clear();
            ddlPreferedLocation.AppendDataBoundItems = true;
            ddlPreferedLocation.DataTextField = "CITY";
            ddlPreferedLocation.DataValueField = "ID";
            ddlPreferedLocation.Items.Add("Select");
            ddlPreferedLocation.Items[0].Value = "0";
            ddlPreferedLocation.DataSource = objIN_TB_CITY;
            ddlPreferedLocation.DataBind();

            //Current Location

            objclsCity = new clsCity();
            objIN_TB_CITY = new List<IN_TB_CITY>();
            objIN_TB_CITY = objclsCity.GetAllCities();
            ddlcurrentLocation.Items.Clear();
            ddlcurrentLocation.AppendDataBoundItems = true;
            ddlcurrentLocation.DataTextField = "CITY";
            ddlcurrentLocation.DataValueField = "ID";
            ddlcurrentLocation.Items.Add("Select");
            ddlcurrentLocation.Items[0].Value = "0";
            ddlcurrentLocation.DataSource = objIN_TB_CITY;
            ddlcurrentLocation.DataBind();

            // Project Location
            objclsCity = new clsCity();
            objIN_TB_CITY = new List<IN_TB_CITY>();
            objIN_TB_CITY = objclsCity.GetAllCities();
            ddlProjectLocation.Items.Clear();
            ddlProjectLocation.AppendDataBoundItems = true;
            ddlProjectLocation.DataTextField = "CITY";
            ddlProjectLocation.DataValueField = "ID";
            ddlProjectLocation.Items.Add("Select");
            ddlProjectLocation.Items[0].Value = "0";
            ddlProjectLocation.DataSource = objIN_TB_CITY;
            ddlProjectLocation.DataBind();

            // Functional Area
            clsFunctionalAreaDAL objclsFunctionalAreaDAL = new clsFunctionalAreaDAL();
            List<IN_TB_FUNCTIONAL_AREA> objIN_TB_FUNCTIONAL_AREA = new List<IN_TB_FUNCTIONAL_AREA>();
            objIN_TB_FUNCTIONAL_AREA = objclsFunctionalAreaDAL.GetAllFunctionalAreas();
            ddlFuntionalArea.Items.Clear();
            ddlFuntionalArea.AppendDataBoundItems = true;
            ddlFuntionalArea.DataTextField = "FUNCTIONAL_AREA";
            ddlFuntionalArea.DataValueField = "ID";
            ddlFuntionalArea.Items.Add("Select");
            ddlFuntionalArea.Items[0].Value = "0";
            ddlFuntionalArea.DataSource = objIN_TB_FUNCTIONAL_AREA;
            ddlFuntionalArea.DataBind();

            // Have Visa
            ddlHaveVisa.Items.Clear();
            ddlHaveVisa.AppendDataBoundItems = true;
            ddlHaveVisa.Items.Add("Select");
            ddlHaveVisa.Items[0].Value = "-1";
            ddlHaveVisa.Items.Add("No");
            ddlHaveVisa.Items[1].Value = "0";
            ddlHaveVisa.Items.Add("Yes");
            ddlHaveVisa.Items[2].Value = "1";

            // Technology Experience
            ddlTechnologyExperience.Items.Clear();
            ddlTechnologyExperience.AppendDataBoundItems = true;
            ddlTechnologyExperience.Items.Add("Select");
            ddlTechnologyExperience.Items[0].Value = "0";
            for (int i = 1; i <= 30; i++)
            {
                ddlTechnologyExperience.Items.Add(i.ToString());
                ddlTechnologyExperience.Items[i].Value = i.ToString();
            }
            ddlTechnologyExperience.DataBind();

            // Total Experience
            ddlTotalExp.Items.Clear();
            ddlTotalExp.AppendDataBoundItems = true;
            ddlTotalExp.Items.Add("Select");
            ddlTotalExp.Items[0].Value = "0";
            for (int i = 1; i <= 30; i++)
            {
                ddlTotalExp.Items.Add(i.ToString());
                ddlTotalExp.Items[i].Value = i.ToString();
            }
            ddlTotalExp.DataBind();

            // Project Experience
            ddlProjectExperience.Items.Clear();
            ddlProjectExperience.AppendDataBoundItems = true;
            ddlProjectExperience.Items.Add("Select");
            ddlProjectExperience.Items[0].Value = "0";
            for (int i = 1; i <= 60; i++)
            {
                ddlProjectExperience.Items.Add(i.ToString());
                ddlProjectExperience.Items[i].Value = i.ToString();
            }
            ddlProjectExperience.DataBind();


            // Job Type
            clsJobTypeDAL objclsJobTypeDAL = new clsJobTypeDAL();
            List<IN_TB_JOB_TYPE> objIN_TB_JOB_TYPE = new List<IN_TB_JOB_TYPE>();
            objIN_TB_JOB_TYPE = objclsJobTypeDAL.GetAllJobTypes();
            ddlDJobType.Items.Clear();
            ddlDJobType.AppendDataBoundItems = true;
            ddlDJobType.DataTextField = "JOB_TYPE";
            ddlDJobType.DataValueField = "ID";
            ddlDJobType.Items.Add("Select");
            ddlDJobType.Items[0].Value = "0";
            ddlDJobType.DataSource = objIN_TB_JOB_TYPE;
            ddlDJobType.DataBind();

            // Employment Type
            clsEmploymentTypeDAL objclsEmploymentTypeDAL = new clsEmploymentTypeDAL();
            List<IN_TB_EMPLOYMENT_TYPE> objIN_TB_EMPLOYMENT_TYPE = new List<IN_TB_EMPLOYMENT_TYPE>();
            objIN_TB_EMPLOYMENT_TYPE = objclsEmploymentTypeDAL.GetAllEmploymentTypes();
            ddlDemploymentType.Items.Clear();
            ddlDemploymentType.AppendDataBoundItems = true;
            ddlDemploymentType.DataTextField = "EMPLOYMENT_TYPE";
            ddlDemploymentType.DataValueField = "ID";
            ddlDemploymentType.Items.Add("Select");
            ddlDemploymentType.Items[0].Value = "0";
            ddlDemploymentType.DataSource = objIN_TB_EMPLOYMENT_TYPE;
            ddlDemploymentType.DataBind();

            // Visa Type
            clsVisaTypeDAL objclsVisaTypeDAL = new clsVisaTypeDAL();
            List<IN_TB_VISA_TYPE> objIN_TB_VISA_TYPE = new List<IN_TB_VISA_TYPE>();
            objIN_TB_VISA_TYPE = objclsVisaTypeDAL.GetAllEmploymentTypes();
            ddlVisaType.Items.Clear();
            ddlVisaType.AppendDataBoundItems = true;
            ddlVisaType.DataTextField = "VISA_TYPE";
            ddlVisaType.DataValueField = "ID";
            ddlVisaType.Items.Add("Select");
            ddlVisaType.Items[0].Value = "0";
            ddlVisaType.DataSource = objIN_TB_VISA_TYPE;
            ddlVisaType.DataBind();

            // Work Permit Type
            clsPermitTypeDAL objclsPermitTypeDAL = new clsPermitTypeDAL();
            List<IN_TB_WORK_PERMIT_TYPE> objIN_TB_WORK_PERMIT_TYPE = new List<IN_TB_WORK_PERMIT_TYPE>();
            objIN_TB_WORK_PERMIT_TYPE = objclsPermitTypeDAL.GetAllWorkPermitTypes();
            ddlWorkPermitType.Items.Clear();
            ddlWorkPermitType.AppendDataBoundItems = true;
            ddlWorkPermitType.DataTextField = "WORK_PERMIT_TYPE";
            ddlWorkPermitType.DataValueField = "ID";
            ddlWorkPermitType.Items.Add("Select");
            ddlWorkPermitType.Items[0].Value = "0";
            ddlWorkPermitType.DataSource = objIN_TB_WORK_PERMIT_TYPE;
            ddlWorkPermitType.DataBind();

        }
        catch (Exception)
        {

            throw;
        }
    }
    protected void btnupdateGeneralInfo_Click(object sender, EventArgs e)
    {
        try
        {


            clsUserLoginDAL objclsUserLoginDAL = new clsUserLoginDAL();
            //Saving User
            IN_TB_USER objIN_TB_USER = new IN_TB_USER();

            if (Session["UserId"] != null)
            {
                objIN_TB_USER = objclsUserLoginDAL.GetUserByID(Convert.ToInt32(Session["UserId"].ToString()));
                objIN_TB_USER.NAME = txtFirstName.Text;
                objIN_TB_USER.MOBILE = txtMobileNumber.Text;
                objIN_TB_USER.EMAIL = txtEmail.Text;
                objIN_TB_USER.STATUS = 1;
                objIN_TB_USER.ROLEID = 4;
                objIN_TB_USER.DOB = Convert.ToDateTime(txtDOB.Text);
                objIN_TB_USER.CREATED_BY = 1;
                UserId = objclsUserLoginDAL.SaveUser(objIN_TB_USER);
            }

            // Saving User Profile
            if (ViewState["ProfileId"] != null)
            {
                clsProfileDAL objclsProfileDAL = new clsProfileDAL();
                IN_TB_PROFILE objIN_TB_PROFILE = new IN_TB_PROFILE();
                int pid = Convert.ToInt32(ViewState["ProfileId"].ToString());
                objIN_TB_PROFILE = objclsProfileDAL.GetProfileById(pid);
                objIN_TB_PROFILE.F_NAME = txtFirstName.Text;
                objIN_TB_PROFILE.M_NAME = txtMiddleName.Text;
                objIN_TB_PROFILE.L_NAME = txtLastName.Text;
                objIN_TB_PROFILE.FATHER = txtFather.Text;
                objIN_TB_PROFILE.DOB = Convert.ToDateTime(txtDOB.Text);
                objIN_TB_PROFILE.GENDER = ddlGender.SelectedValue;
                objIN_TB_PROFILE.CITY = Convert.ToInt32(ddlCity.SelectedValue);
                objIN_TB_PROFILE.PHONE = txtPhoneNumber.Text;
                objIN_TB_PROFILE.MOBILE = txtMobileNumber.Text;
                objIN_TB_PROFILE.EMAIL = txtEmail.Text;
                if (Session["UserId"] != null)
                    objIN_TB_PROFILE.USER_ID = Convert.ToInt32(Session["UserId"]);
                int profieleid = objclsProfileDAL.SaveProfile(objIN_TB_PROFILE);
            }
        }
        catch (Exception)
        {

            throw;
        }
    }
    protected void btnUpdateProfessionalDetails_Click(object sender, EventArgs e)
    {
        try
        {
            if (Session["UserId"] != null && ViewState["ResumeMasterId"] != null)
            {
                int rid = Convert.ToInt32(ViewState["ResumeMasterId"].ToString());
                clsResumeDAL objclsResumeDAL = new clsResumeDAL();
                IN_TB_RESUME_MST ibjIN_TB_RESUME_MST = new IN_TB_RESUME_MST();
                ibjIN_TB_RESUME_MST = objclsResumeDAL.GetResumeById(rid);
                ibjIN_TB_RESUME_MST.KEY_SKILLS = txtKeySkills.Text;
                ibjIN_TB_RESUME_MST.RESUME_HEADLINE = txtResumeheadline.Text;
                ibjIN_TB_RESUME_MST.RESUME_SUMMARY = txtResumeSummary.Text;
                ibjIN_TB_RESUME_MST.CTC = txtCTC.Text;
                ibjIN_TB_RESUME_MST.CURRENT_DESIGNATION = txtCurrentDesignation.Text;
                ibjIN_TB_RESUME_MST.CURRENT_COMPANY = txtCurrentCompany.Text;
                ibjIN_TB_RESUME_MST.PREFERRED_LOCATION = ddlPreferedLocation.SelectedValue;
                ibjIN_TB_RESUME_MST.CURRENT_LOCATION = Convert.ToInt32(ddlcurrentLocation.SelectedValue);
                ibjIN_TB_RESUME_MST.TOTAL_EXP = Convert.ToInt32(ddlTotalExp.SelectedValue);
                ibjIN_TB_RESUME_MST.FUNCTIONAL_AREA = Convert.ToInt32(ddlFuntionalArea.SelectedValue);
                ibjIN_TB_RESUME_MST.USER_ID = Convert.ToInt32(Session["UserId"]);
                if (fuResume.HasFile)
                {
                    // Saving User Resume
                    string CVPath = Server.MapPath("~/Resumes/");
                    DirectoryInfo objFileInfo = new DirectoryInfo(CVPath);
                    if (!objFileInfo.Exists)
                        objFileInfo.Create();
                    fuResume.SaveAs(CVPath + "/" + fuResume.FileName);
                    ibjIN_TB_RESUME_MST.RESUME_PATH = Convert.ToInt32(Session["UserId"]) + "/" + fuResume.FileName;
                }
                int resumeid = objclsResumeDAL.SaveResume(ibjIN_TB_RESUME_MST);
            }
        }
        catch (Exception)
        {

            throw;
        }

    }
    protected void btnProjectDetaiils_Click(object sender, EventArgs e)
    {
        try
        {
            List<IN_TB_USER_PROJECT> objIN_TB_USER_PROJECTList = new List<IN_TB_USER_PROJECT>();
            objIN_TB_USER_PROJECTList = (List<IN_TB_USER_PROJECT>)Session["objIN_TB_USER_PROJECT"];
            clsProjectDetailDAL objclsProjectDetailDAL = new clsProjectDetailDAL();

            foreach (IN_TB_USER_PROJECT objIN_TB_USER_PROJECT in objIN_TB_USER_PROJECTList)
            {
                if (Session["UserId"] != null)
                    objIN_TB_USER_PROJECT.USERID = Convert.ToInt32(Session["UserId"]);
                objIN_TB_USER_PROJECT.CREATED_BY = 1;
                objIN_TB_USER_PROJECT.MODIFIED_BY = 1;
                objclsProjectDetailDAL.SaveProject(objIN_TB_USER_PROJECT);
            }

        }
        catch (Exception)
        {

            throw;
        }




    }
    protected void btnResumeSkills_Click(object sender, EventArgs e)
    {
        try
        {
            List<IN_TB_RRESUME_SKILL> objIN_TB_RRESUME_SKILLList = new List<IN_TB_RRESUME_SKILL>();
            objIN_TB_RRESUME_SKILLList = (List<IN_TB_RRESUME_SKILL>)Session["objIN_TB_RRESUME_SKILLList"];

            clsResumeSkillsDAL objclsResumeSkillsDAL = new clsResumeSkillsDAL();
            foreach (IN_TB_RRESUME_SKILL ibjIN_TB_RRESUME_SKILL in objIN_TB_RRESUME_SKILLList)
            {
                objclsResumeSkillsDAL = new clsResumeSkillsDAL();
                if (Session["UserId"] != null)
                    ibjIN_TB_RRESUME_SKILL.USERID = Convert.ToInt32(Session["UserId"]);
                ibjIN_TB_RRESUME_SKILL.CREATED_BY = 1;
                ibjIN_TB_RRESUME_SKILL.MODIFIED_BY = 1;
                int resumeSkillid = objclsResumeSkillsDAL.SaveResumeSkills(ibjIN_TB_RRESUME_SKILL);
            }

        }
        catch (Exception)
        {

            throw;
        }

    }
    protected void btnOtherinfo_Click(object sender, EventArgs e)
    {
        try
        {

            clsOtherDAL objclsOtherDAL = new clsOtherDAL();
            IN_TB_OTHER ibjIN_TB_OTHER = new IN_TB_OTHER();
            if (Session["UserId"] != null)
                ibjIN_TB_OTHER.USER_ID = Convert.ToInt32(Session["UserId"]);
            ibjIN_TB_OTHER.DESIRED_JOB_TYPE = Convert.ToInt32(ddlDJobType.SelectedValue);
            ibjIN_TB_OTHER.DESIRED_EMPOLOYMENT_TYPE = Convert.ToInt32(ddlDemploymentType.SelectedValue);
            ibjIN_TB_OTHER.WORK_PERMIT_LOCATION = Convert.ToInt32(ddlWorkPermitType.SelectedValue);
            ibjIN_TB_OTHER.HAVE_VISA = Convert.ToInt32(ddlHaveVisa.SelectedValue);
            ibjIN_TB_OTHER.VISA_TYPE = Convert.ToInt32(ddlVisaType.SelectedValue);
            ibjIN_TB_OTHER.CREATED_BY = ibjIN_TB_OTHER.USER_ID;
            ibjIN_TB_OTHER.CREATED_ON = DateTime.Now;
            ibjIN_TB_OTHER.MODIFIED_BY = ibjIN_TB_OTHER.USER_ID;
            ibjIN_TB_OTHER.MODIFIED_ON = DateTime.Now;
            int resumeid = objclsOtherDAL.SaveLOtherInfo(ibjIN_TB_OTHER);



        }
        catch (Exception)
        {

            throw;
        }





    }
    protected void CreateRESUME_SKILLList()
    {
        List<IN_TB_RRESUME_SKILL> objIN_TB_RRESUME_SKILLList = new List<IN_TB_RRESUME_SKILL>();
        Session["objIN_TB_RRESUME_SKILLList"] = objIN_TB_RRESUME_SKILLList;
    }
    protected void BtnAddSkills_Click(object sender, EventArgs e)
    {
        List<IN_TB_RRESUME_SKILL> objIN_TB_RRESUME_SKILLList = new List<IN_TB_RRESUME_SKILL>();
        objIN_TB_RRESUME_SKILLList = (List<IN_TB_RRESUME_SKILL>)Session["objIN_TB_RRESUME_SKILLList"];
        IN_TB_RRESUME_SKILL objIN_TB_RRESUME_SKILL = new IN_TB_RRESUME_SKILL();

        objIN_TB_RRESUME_SKILL.TECHNOLOGY = txtTechnology.Text.Trim();
        objIN_TB_RRESUME_SKILL.LAST_USED = DateTime.ParseExact(txtLastUsed.Text, "dd-MMM-yyyy", CultureInfo.CurrentCulture, DateTimeStyles.None);
        objIN_TB_RRESUME_SKILL.EXPERIENCE = Convert.ToInt32(ddlTechnologyExperience.SelectedValue);
        objIN_TB_RRESUME_SKILLList.Add(objIN_TB_RRESUME_SKILL);
        Session["objIN_TB_RRESUME_SKILLList"] = objIN_TB_RRESUME_SKILLList;
        grdTechnology.DataSource = objIN_TB_RRESUME_SKILLList;
        grdTechnology.DataBind();

    }
    protected void CreateProjectList()
    {
        List<IN_TB_USER_PROJECT> objIN_TB_USER_PROJECT = new List<IN_TB_USER_PROJECT>();
        Session["objIN_TB_USER_PROJECT"] = objIN_TB_USER_PROJECT;
    }
    protected void btnAddProject_Click(object sender, EventArgs e)
    {
        List<IN_TB_USER_PROJECT> objIN_TB_USER_PROJECTList = new List<IN_TB_USER_PROJECT>();
        objIN_TB_USER_PROJECTList = (List<IN_TB_USER_PROJECT>)Session["objIN_TB_USER_PROJECT"];
        IN_TB_USER_PROJECT objIN_TB_USER_PROJECT = new IN_TB_USER_PROJECT();
        objIN_TB_USER_PROJECT.DESIGNATION = txtDesignation.Text;
        objIN_TB_USER_PROJECT.DURATION_END = DateTime.ParseExact(txtEndDate.Text, "dd-MMM-yyyy", CultureInfo.CurrentCulture, DateTimeStyles.None);
        objIN_TB_USER_PROJECT.DURATION_START = DateTime.ParseExact(txtStarrDate.Text, "dd-MMM-yyyy", CultureInfo.CurrentCulture, DateTimeStyles.None);
        objIN_TB_USER_PROJECT.EMPLOYER_NAME = txtEmployer.Text;
        objIN_TB_USER_PROJECT.EMPLOYMENT_TYPE = txtProjectEmploymentType.Text;
        objIN_TB_USER_PROJECT.EXPERIENCE = Convert.ToInt32(ddlProjectExperience.SelectedValue);
        objIN_TB_USER_PROJECT.PROJECT_DETAILS = txtProjectDetails.Text;
        objIN_TB_USER_PROJECT.PROJECT_LOCATION = Convert.ToInt32(ddlProjectLocation.SelectedValue);
        objIN_TB_USER_PROJECT.PROJECT_TITLE = txtProjectTiltel.Text;
        objIN_TB_USER_PROJECT.ROLE = txtRole.Text;
        objIN_TB_USER_PROJECT.ROLE_DESCRIPTION = txtRoleDescription.Text;
        objIN_TB_USER_PROJECT.SKILLS_USED = txtProjectKeySkills.Text;
        objIN_TB_USER_PROJECT.TEAM_SIZE = Convert.ToInt32(txtTeamSize.Text);
        objIN_TB_USER_PROJECTList.Add(objIN_TB_USER_PROJECT);
        Session["objIN_TB_USER_PROJECT"] = objIN_TB_USER_PROJECTList;
        grdProjectDetails.DataSource = objIN_TB_USER_PROJECTList;
        grdProjectDetails.DataBind();
    }
    //private void txtEmail_Validating(object sender, CancelEventArgs e)
    //{
    //    System.Text.RegularExpressions.Regex rEMail = new System.Text.RegularExpressions.Regex(@"^[a-zA-Z][\w\.-]{2,28}[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$");
    //    if (txtEmail.Text.Length > 0)
    //    {
    //        if (!rEMail.IsMatch(txtEmail.Text))
    //        {
    //            MessageBox.Show("E-Mail expected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    //            txtEmail.SelectAll();
    //            e.Cancel = true;
    //        }
    //    }
    //}

    protected void txtPhoneNumber_TextChanged(object sender, EventArgs e)
    {
        if (!(string.IsNullOrEmpty(txtPhoneNumber.Text)))
        {

            char[] chars = txtPhoneNumber.Text.ToCharArray();
            for (int i = 0; i < txtPhoneNumber.Text.Length; i++)
            {
                int code;
                code = Convert.ToInt16(chars);
                if (!((!(code > 58 || code < 48)) || (code == 68) || (code == 78) || (code == 35) || (code == 46)))
                {
                    txtPhoneNumber.Text = txtPhoneNumber.Text.Remove(i, 1);
                    //txtPhoneNumber.SelectionStart = txtPhoneNumber.Text.Length;
                }
            }
        }
    }
    protected void txtMobileNumber_TextChanged(object sender, EventArgs e)
    {
        if (!(string.IsNullOrEmpty(txtMobileNumber.Text)))
        {

            char[] chars = txtMobileNumber.Text.ToCharArray();
            for (int i = 0; i < txtMobileNumber.Text.Length; i++)
            {
                int code;
                code = Convert.ToInt16(chars);
                if (!((!(code > 58 || code < 48)) || (code == 68) || (code == 78) || (code == 35) || (code == 46)))
                {
                    txtMobileNumber.Text = txtMobileNumber.Text.Remove(i, 1);
                    // txtMobileNumber.SelectionStart = txtMobileNumber.Text.Length;
                }
            }
        }
    }
    private void txtResumeheadline_KeyPress(object sender, KeyPressEventArgs e)
    {
        if ((e.KeyChar >= 65 && e.KeyChar <= 90) || (e.KeyChar >= 97 && e.KeyChar <= 122) || e.KeyChar == 32 || e.KeyChar == 8)
        {
            e.Handled = false;
        }
        else
        {
            MessageBox.Show("Invalid Input");
            e.Handled = true;
        }
    }

    protected void imgDob_Click(object sender, ImageClickEventArgs e)
    {
        //try
        //{
        //    clDob.Visible = true;
        //}
        //catch (Exception)
        //{

        //    throw;
        //}
    }
    protected void clDob_SelectionChanged(object sender, EventArgs e)
    {
        //try
        //{
        //    txtDOB.Text = clDob.SelectedDate.ToString("dd-MMM-yyyy");
        //    clDob.Visible = false;
        //}
        //catch (Exception)
        //{

        //    throw;
        //}

    }

    protected void imgStartDate_Click(object sender, ImageClickEventArgs e)
    {
        //clStartDate.Visible = true;
    }
    protected void clStartDate_SelectionChanged(object sender, EventArgs e)
    {
        //txtStarrDate.Text = clStartDate.SelectedDate.ToString("dd-MMM-yyyy");
        //clStartDate.Visible = false;
    }
    protected void imgEndDate_Click(object sender, ImageClickEventArgs e)
    {
        //clEndDate.Visible = true;
    }
    protected void clEndDate_SelectionChanged(object sender, EventArgs e)
    {
        //txtEndDate.Text = clEndDate.SelectedDate.ToString("dd-MMM-yyyy");
        //clEndDate.Visible = false;
    }
    protected void grdProjectDetails_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //Getting Preferred Location
            int Preferred_locationId = Convert.ToInt32(e.Row.Cells[4].Text);
            clsCity objclsCity = new clsCity();
            IN_TB_CITY objIN_TB_CITY = new IN_TB_CITY();
            objIN_TB_CITY = objclsCity.GetCityById(Preferred_locationId);
            e.Row.Cells[4].Text = objIN_TB_CITY.CITY;
        }
    }
}
